package com.webserve.core;

import javax.xml.stream.events.StartDocument;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class BirdServer {
    ServerSocket serversocket;

    public BirdServer(){
        try {
            System.out.println("正在启动服务器...");
            serversocket = new ServerSocket(8088);
            System.out.println("服务器启动完成!");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }


    public void start(){
        try {
            while (true) {
                System.out.println("等待客户端练连接...");
                Socket socket = serversocket.accept();
                System.out.println("客户端已连接!");
                ClientHandler handler = new ClientHandler(socket);
                Thread t = new Thread(handler);
                t.start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }


    public static void main(String[] args) {
        BirdServer birdServer = new BirdServer();
        birdServer.start();

    }
}
